package com.example.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.example.INews;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WeatherInfoController {
    @Reference(check = false, version = "1.1.2", cluster = "failsafe",timeout = 50)
    //通过check= false来避免循环依赖,通过version来设定版本号，
    // 用于表示调用的是dubbo中的哪一个版本的服务,
    // 设定容错机制为failSafe，设定超时时间为50ms
    private INews newsImpl;

    @GetMapping("/dailyInfo")
    public Object getWeatherInfo() {
        return newsImpl.getDailyNews();
    }
}
